<?php
if(!defined('PATH')) exit();

$characters = $account->getPlayersList();
$characters->orderBy('name');

$characterList = null;
foreach($characters as $row)
{
	if (!$row->isDeleted() && !$row->getRank() && $row->getLevel() >= $this->config['website']['guild']['levelToCreate']) {
		$characterList .= '<option value="'.$row->getName().'">'.$row->getName().'</option>';
	}
}
if ($characterList) {
?>
<br />
<form action="<?=PATH?>/guilds/create" method="post">
<table border="0" cellpadding="8" cellspacing="1" width="100%">
<tr><td colspan="2" class="head"><b>Choose character</b></td></tr>
<tr><td width="20%">Character:</td><td>
<select name="character">
<?=$characterList?>
</select>
</td></tr>
<tr><td colspan="2"><input type="submit" name="selected_character" value="Submit" /></td></tr>
</table>
</form>
<?php
} else {
	$this->archez->showMsg('An error has occurred it might be caused by the following reason : <ul><li>All of your characters are members of a guild</li><li>Your characters don\'t fulfill the level requirements to create a guild</li></ul></br>If you wan\'t to get back to the guilds list <a href="' . PATH . '/guilds/">click here</a>.', 'error');
}
?>
